<template>
  <a-select :disabled="disabled" :placeholder="placeholder" v-model="copyValue">
    <a-option v-for="item in list" :key="item.id" :value="item.id">
      {{ item.name }}
    </a-option>
  </a-select>
</template>

<script setup lang="ts">
  import { ref, computed } from 'vue';
  import { GetPersonnelinformation } from '@/api/home/System settings/personal-information/index';

  const props = withDefaults(
    // 参数说明
    defineProps<{
      placeholder?: string;
      value?: number;
      disabled?: boolean;
    }>(),
    {
      placeholder: '请选择人员',
      disabled: false,
    }
  );
  let emit = defineEmits(['update:value']);
  let copyValue = computed({
    get: () => {
      return props.value;
    },
    set: (val) => {
      emit('update:value', val);
    },
  });

  let list = ref<any[]>([]);
  let loadDate = async () => {
    let res = await GetPersonnelinformation({ page: 1, size: -1 });
    list.value = res.content.data || [];
  };
  loadDate();
</script>

<style scoped></style>
